home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac 1993 September
/
clonecd
/
September 93.img
/
Archives
/
Applications
/
Assorted Programs
/
PCB Cad
/
ALLOC.C
next >
Wrap
C/C++ Source or Header
|
1990-10-10
|
634b
|
27 lines
#include <stdio.h>
#include <stdlib.h>
/*#include <dos.h>*/
/*char far *Alloc( long );*/
void Nomem( void );
/*char far *Alloc ( x ) (* allocate x bytes of far memory *)
long x;
{
union REGS regs;
regs.h.ah = 0x48; (* allocate memory dos call *)
x = (x+15)>>4; (* get number of paragraphs to allocate *)
regs.x.bx = (int)x;
intdos( ®s, ®s ); (* call dos; request memory *)
if (regs.x.cflag) (* memory allocation error *)
Nomem();
return( (char far *)((long)regs.x.ax<<16) ); (* make a far pointer *)
}
*/
void Nomem () { /* a memory allocation request has failed */
printf( "out of memory\n" );
exit( -1 );
}